import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/pages/Home'
import Charts from '@/pages/Charts'
import Rules from '@/pages/rules'
import Mine from '@/pages/mine'
import Detail from '@/pages/detail'
import Join from '@/pages/join'
import Edit from '@/pages/edit'
import Share from '@/pages/Share'

Vue.use(Router)

export default new Router({
  routes: [
    {
      path: '/',
      name: 'Home',
      component: Home
    },
    {
      path: '/charts',
      name: 'Charts',
      component: Charts
    },
    {
      path: '/rules',
      name: 'Rules',
      component: Rules
    },
    {
      path: '/mine',
      name: 'Mine',
      component: Mine
    },
    {
      path: '/detail/:id',
      name: 'Detail',
      component: Detail
    },
    {
      path: '/join',
      name: 'Join',
      component: Join
    },
    {
      path: '/edit',
      name: 'Edit',
      component: Edit
    },
    {
      path: '/share/:id',
      name: 'Share',
      component: Share
    }
  ],
  scrollBehavior (to, from, savedPosition) {
    return new Promise((resolve, reject) => {
      setTimeout(() => {
        resolve({ x: 0, y: 1 })
      }, 1)
    })
  }
})
